package com.cqhfan.chatroom.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDateTime;

import com.cqhfan.chatroom.enums.ChatType;
import com.cqhfan.chatroom.enums.MessageType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 聊天消息记录
 * </p>
 *
 * @author 眭传洪
 * @since 2024-11-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("chat_message")
public class ChatMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 发送者
     */
    private Long senderId;

    /**
     * 接收者
     */
    private Long receiverId;

    /**
     * 消息内容
     */
    private String content;

    /**
     * 消息类型
     */
    private MessageType messageType;

    /**
     * 聊天类型
     */
    private ChatType chatType;

    /**
     * 群id
     */
    private Long groupId;

    /**
     * 语音时长
     */
    private Integer voiceDuration;

    /**
     * 语音地址
     */
    private String voiceUrl;

    /**
     * 是否已读
     */
    private Boolean ifRead;

    /**
     * 聊天时间
     */
    private String chatTime;

    private Long chatListId;

    private LocalDateTime createTime;

}
